# 22. 开源项目热度榜单
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let inputs = [];
rl.on('line', function(str)) {
inputs.push(str);
}
rl.on('close', function() {
const N = parseInt(inputs[0]);
const weights = input[1].split(' ').map(Number);
let projects = [];
for(let i=2; i<n+2; i++) {
const project = input[i].split(' ');
const name = project[0];
const scores = project.slice(1).map(Number);
let hotness = 0;
for(let j=0; j<5; j++) {
hotness += scores[j] * weights[j];
}
projects.push({name, hotness});
}
projects.sort((a,b) => {
if(a.hotness !== b.hotness) {
return b.hotness - a.hotness;
} else {
return a.name.toLocaleLowerCase() - b.name.toLocaleLowerCase();
}
});
for(let project of projects) {
console.log(project.name);
}
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37